package com.atguigu.gmall.product.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.atguigu.gmall.product.entity.BaseCategory2;
import com.atguigu.gmall.product.service.BaseCategory2Service;
import com.atguigu.gmall.product.mapper.BaseCategory2Mapper;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author 李天玉
 * @description 针对表【base_category2(二级分类表)】的数据库操作Service实现
 * @createDate 2025-08-15 14:26:50
 */
@Service
public class BaseCategory2ServiceImpl extends ServiceImpl<BaseCategory2Mapper, BaseCategory2>
        implements BaseCategory2Service {
    /**
     * 根据1级分类id，查找对应的2级分类id
     * @param category1_id
     * @return
     */
    @Override
    public List<BaseCategory2> getCategory2(Long category1_id) {
        LambdaQueryWrapper<BaseCategory2> wrapper = new LambdaQueryWrapper<>();
        wrapper.eq(BaseCategory2::getCategory1Id, category1_id);
        List<BaseCategory2> list = list(wrapper);
        return list;
    }
}




